<%@ page contentType="text/html;charset=utf-8" language="java" import="java.sql.*"%>
<jsp:useBean id="dbConnection" scope="page" class="DB.DBConnection"/>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>REG-209ChatRoom</title>
    <link href="CSS/style.css" rel="stylesheet">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
	<script type="text/javascript" src="reg.js"></script>
  </head>
  
  <body onload="init();">
<center>
<form name=form1 action="regaction.jsp" method="post" >
<table width="265" border="0" background="images/login.png">
	<tr><td height="100"></td></tr>
  <tr>
    <td>用户名</td>
    
    <td align="left"><input name="UserName" type="text" value="">
     <span class="Redfont">*</span></td>
  </tr>
  <tr>
    <td>密&nbsp;&nbsp;码</td>
    <td align="left"><input name="UserPwd" type="password" value="" >
     <span class="Redfont">*</span></td>
  </tr>
  <tr>
    <td>重复密码</td>
    <td align="left"><input name="ReUserPwd" type="password" value="">
     <span class="Redfont">*</span></td>
  </tr>
  <tr>
    <td>邮&nbsp;&nbsp;箱</td>
    <td align="left"><input name="UserEMail" type="text" value="" onclick="pwdcheck();"></td>
  </tr>
  <tr>
    <td>性&nbsp;&nbsp;别</td>
    <td align="left">
      <select name="Sex">
	  <option value="0">男</option>
	  <option value="1">女</option>
      </select>    
     </td>
  </tr>
  <tr>
    <td>生&nbsp;&nbsp;日</td>
    <td align="left"><select name=year size=1 onChange="showmonth();">
<script>
	var yearbegin=1900,yearend=2005;
	document.write("<option value=''selected>年</option>")
	for(var i=yearbegin;i<=yearend;i++){
	document.write ("<option value="+i+">"+i+"</option>")
	}
</script>
</select>

<select name=month size=1 onChange="showday();">
    <option value="">月</option>
</select>

<select name=day size=1 onChange="TestMail();">
<option value="">日</option>
</select></td>
  </tr>
  <tr>
    <td>省&nbsp;&nbsp;份</td>
    <td align="left">
		<select id="prov" name="prov" onchange="change_province(this.value);">
	
		</select>
	</td>
  </tr>
  <tr>
    <td>城&nbsp;&nbsp;市</td>
    <td align="left">
		<select id="city" name="city">
		
		</select>	
	</td>
  </tr>
  <tr>
    <td height="87">个性签名</td>
    <td align="left">
      <textarea name="Remark"></textarea>    </td>
  </tr>
  <tr>
    <td height="23">&nbsp;</td>
    <td><input name="注册" align="middle" type="Submit" value="注册"></td>
  </tr>
</table>
</form>
</center>
</body>
<script>
var elYear=eval(document.form1.year)
var elMonth=eval(document.form1.month);
function showmonth(){
	if(elYear.value!=""){
		for(var i=0;i<12;i++){
			elMonth.options.add(new Option(i+1, i+1));
		}
	}
}

function showday(){
	var elDay=eval(document.form1.day);
	if(elMonth.value!="" && elYear.value!=""){
		elDay.length=0;
		for(var i=0;i<28;i++){
			elDay.options.add(new Option(i+1, i+1)); 
		}
		if(elMonth.value!="2"){
			elDay.options.add(new Option(29, 29));
			elDay.options.add(new Option(30, 30));
		}
		switch(elMonth.value){
			case "1":
			case "3":
			case "5":
			case "7":
			case "8":
			case "10":
			case "12":{
				elDay.options.add(new Option(31, 31));
			}
			case "2":{
				var nYear=elYear.value;
				if(nYear%400==0 || nYear%4==0 && nYear%100!=0)elDay.options.add(new Option(29, 29));
			}
		}
	}
}
function pwdcheck(){
	if(document.form1.UserPwd.value!=document.form1.ReUserPwd.value)
		{alert("两次输入的密码不一致，请重新输入！");
		document.form1.UserPwd.focus();
		document.form1.ReUserPwd.focus();
		return false;
	}
	return true;
}
function TestMail(){
	if((document.form1.UserEMail.value.indexOf('@') == -1) || (document.form1.UserEMail.value.indexOf('.') == -1))
	{
		alert("请输入完整的电子邮件地址。例如 we@209ChatRoom.com。");
		document.form1.UserEMail.focus();
		return false;
	}
}

</script>
</html>
